/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.gui.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JFrame;

import ui.WindowManager;
import ui.gui.documents.AbstractDocument;
import ui.gui.documents.EditorAction;

/**
 *
 * @author stephane
 */

public class DocumentAction extends AbstractAction
{
    private static final long serialVersionUID = 1L;
    private EditorAction _actionName = null;
    public DocumentAction(JFrame parent, EditorAction action)
    {
        super(action.getValue(NAME).toString(), new javax.swing.ImageIcon(DocumentAction.class.getResource("/resources/workspaceIcon.png")));
        _actionName = action;
        putValue(SHORT_DESCRIPTION, action.getValue(SHORT_DESCRIPTION));
        putValue(SMALL_ICON, action.getValue(SMALL_ICON));
    }
    
   
    @Override
    public void actionPerformed(ActionEvent e) {
         AbstractDocument document = WindowManager.getInstance().getSelectedDocument();
        if (document != null) {
            _actionName.actionPerformed(e);
        }
    }
    
}